/*
 * Copyright (c) 2002 Boris Pruessmann and others. All rights reserved. This
 * program and the accompanying materials are made available under the terms of
 * the Common Public License v0.5 which accompanies this distribution, and is
 * available at http://www.eclipse.org/legal/cpl-v05.html
 * 
 * Contributors: Boris Pruessmann - Initial implementation.
 */
package net.sourceforge.perforce.ui.internal.model;

import net.sourceforge.perforce.core.api.IPerforceServer;
import net.sourceforge.perforce.core.resources.IChangelist;
import net.sourceforge.perforce.ui.internal.Policy;

import java.util.Date;

/**
 * @version $Revision: 488 $
 * @author <a href="mailto:bpruessmann@users.sourceforge.net">Boris
 *         Pruessmann</a>
 */
public class DefaultChangelistElement extends ChangelistElement {
  // -------------------------------------------------------------------------
  // Public Constructors

  /**
   * Constructor for ChangelistElement.
   * 
   * @param server reference to the Perforce server.
   * @param cache the pending changelist cache.
   */
  public DefaultChangelistElement(IPerforceServer server, PendingChangelistCache cache) {
    super(server, cache, IChangelist.DEFAULT);

    setClientName(server.getClient());
    setUserName(server.getUser());
    setDescription("");
  }

  // ---------------------------------------------------------------- Public
  // Methods (IChangelist)

  @Override
  public Date getDate() {
    return new Date();
  }

  // ---------------------------------------------------------- Public Methods
  // (IWorkbenchAdapter)

  @Override
  public String getLabel(Object o) {
    if (!(o instanceof DefaultChangelistElement)) {
      return null;
    }

    return Policy.bind("DefaultChangelistElement.getLabel");
  }
}
